Rename update_dom_time() to update_vcpu_system_time().
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 5 Apr 2006 14:00:42 +0000 (15:00 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 5 Apr 2006 14:00:42 +0000 (15:00 +0100)
Introduce new generic function update_domain_wallclock_time().

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/ia64/xen/xentime.c
xen/arch/x86/domain.c
xen/arch/x86/domain_build.c
xen/arch/x86/time.c
xen/common/schedule.c
xen/include/asm-x86/time.h
xen/include/xen/time.h

index af784f7f06dca2ea84690ac82568b948493a0820..97a615440d3ec5894b31353464002d13fa859991 100644 (file)
@@ -84,7 +84,13 @@ s_time_t get_s_time(void)
     return now; 
 }
 
-void update_dom_time(struct vcpu *v)
+void update_vcpu_system_time(struct vcpu *v)
+{
+    /* N-op here, and let dom0 to manage system time directly */
+    return;
+}
+
+void update_domain_wallclock_time(struct domain *d)
 {
     /* N-op here, and let dom0 to manage system time directly */
     return;
index a4e52139bd88b5aa8f2798501018b44769cc9d50..b52770ef80c23411ae757fd13e60094fe2b7ff49 100644 (file)
@@ -363,7 +363,7 @@ int arch_set_info_guest(
     update_pagetables(v);
 
     if ( v->vcpu_id == 0 )
-        init_domain_time(d);
+        update_domain_wallclock_time(d);
 
     /* Don't redo final setup */
     set_bit(_VCPUF_initialised, &v->vcpu_flags);
index 1a80aeb36f07c25e7c8dd304d29e775e9e4c9f20..599753a613916f1c86cdafb381f0b0bf96ba3b4e 100644 (file)
@@ -773,7 +773,7 @@ int construct_dom0(struct domain *d,
     zap_low_mappings(idle_pg_table_l2);
 #endif
 
-    init_domain_time(d);
+    update_domain_wallclock_time(d);
 
     set_bit(_VCPUF_initialised, &v->vcpu_flags);
 
index 286df06a6fd698ce0e0dafd40ffa06052c4b576e..ef4c7901bdd80648e33180561acfa9065282d977 100644 (file)
@@ -670,7 +670,7 @@ static inline void version_update_end(u32 *version)
     (*version)++;
 }
 
-static inline void __update_dom_time(struct vcpu *v)
+static inline void __update_vcpu_system_time(struct vcpu *v)
 {
     struct cpu_time       *t;
     struct vcpu_time_info *u;
@@ -688,11 +688,21 @@ static inline void __update_dom_time(struct vcpu *v)
     version_update_end(&u->version);
 }
 
-void update_dom_time(struct vcpu *v)
+void update_vcpu_system_time(struct vcpu *v)
 {
     if ( v->domain->shared_info->vcpu_info[v->vcpu_id].time.tsc_timestamp != 
          cpu_time[smp_processor_id()].local_tsc_stamp )
-        __update_dom_time(v);
+        __update_vcpu_system_time(v);
+}
+
+void update_domain_wallclock_time(struct domain *d)
+{
+    spin_lock(&wc_lock);
+    version_update_begin(&d->shared_info->wc_version);
+    d->shared_info->wc_sec  = wc_sec;
+    d->shared_info->wc_nsec = wc_nsec;
+    version_update_end(&d->shared_info->wc_version);
+    spin_unlock(&wc_lock);
 }
 
 /* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
@@ -701,40 +711,21 @@ void do_settime(unsigned long secs, unsigned long nsecs, u64 system_time_base)
     u64 x;
     u32 y, _wc_sec, _wc_nsec;
     struct domain *d;
-    shared_info_t *s;
 
     x = (secs * 1000000000ULL) + (u64)nsecs - system_time_base;
     y = do_div(x, 1000000000);
 
+    spin_lock(&wc_lock);
     wc_sec  = _wc_sec  = (u32)x;
     wc_nsec = _wc_nsec = (u32)y;
+    spin_unlock(&wc_lock);
 
     read_lock(&domlist_lock);
-    spin_lock(&wc_lock);
-
     for_each_domain ( d )
-    {
-        s = d->shared_info;
-        version_update_begin(&s->wc_version);
-        s->wc_sec  = _wc_sec;
-        s->wc_nsec = _wc_nsec;
-        version_update_end(&s->wc_version);
-    }
-
-    spin_unlock(&wc_lock);
+        update_domain_wallclock_time(d);
     read_unlock(&domlist_lock);
 }
 
-void init_domain_time(struct domain *d)
-{
-    spin_lock(&wc_lock);
-    version_update_begin(&d->shared_info->wc_version);
-    d->shared_info->wc_sec  = wc_sec;
-    d->shared_info->wc_nsec = wc_nsec;
-    version_update_end(&d->shared_info->wc_version);
-    spin_unlock(&wc_lock);
-}
-
 static void local_time_calibration(void *unused)
 {
     unsigned int cpu = smp_processor_id();
index 4ab5d7d87919a6b36cdc91fed67f36afe399be22..0b1644ea5a1004c311f033b8b36f400e190bf7ad 100644 (file)
@@ -572,7 +572,7 @@ static void __enter_scheduler(void)
     /* Ensure that the domain has an up-to-date time base. */
     if ( !is_idle_vcpu(next) )
     {
-        update_dom_time(next);
+        update_vcpu_system_time(next);
         if ( next->sleep_tick != schedule_data[cpu].tick )
             send_timer_event(next);
     }
@@ -609,7 +609,7 @@ static void t_timer_fn(void *unused)
 
     if ( !is_idle_vcpu(v) )
     {
-        update_dom_time(v);
+        update_vcpu_system_time(v);
         send_timer_event(v);
     }
 
@@ -623,7 +623,7 @@ static void dom_timer_fn(void *data)
 {
     struct vcpu *v = data;
 
-    update_dom_time(v);
+    update_vcpu_system_time(v);
     send_timer_event(v);
 }
 
index 38e4dffcf2a45ad41c81a00178cbc62a6447f943..731ce9500e3a4055643de6fe11f420337218246c 100644 (file)
@@ -7,9 +7,6 @@
 extern void calibrate_tsc_bp(void);
 extern void calibrate_tsc_ap(void);
 
-struct domain;
-extern void init_domain_time(struct domain *d);
-
 typedef u64 cycles_t;
 
 static inline cycles_t get_cycles(void)
index 3a31af01126e240345dd514911669decd3e3b85c..931401388e0add53385bb0134850b0d23f2ed5ed 100644 (file)
@@ -55,7 +55,9 @@ s_time_t get_s_time(void);
 #define MILLISECS(_ms)  ((s_time_t)((_ms) * 1000000ULL))
 #define MICROSECS(_us)  ((s_time_t)((_us) * 1000ULL))
 
-extern void update_dom_time(struct vcpu *v);
+extern void update_vcpu_system_time(struct vcpu *v);
+extern void update_domain_wallclock_time(struct domain *d);
+
 extern void do_settime(
     unsigned long secs, unsigned long nsecs, u64 system_time_base);